package com.mt.demo.controller;


import com.mt.demo.domain.AjaxResult;
import com.mt.demo.domain.MtFile;
import com.mt.demo.domain.TableDataInfo;
import com.mt.demo.service.IMtFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 会议文件Controller
 * 
 * @author gary
 * @date 2025-08-11
 */
@RestController
@RequestMapping("/mt/mtFile")
public class MtFileController extends BaseController
{
    @Autowired
    private IMtFileService mtFileService;

    /**
     * 查询会议文件列表
     */
    @GetMapping("/list")
    public TableDataInfo list(MtFile mtFile)
    {
        startPage();
        List<MtFile> list = mtFileService.selectMtFileList(mtFile);
        return getDataTable(list);
    }

    /**
     * 导出会议文件列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, MtFile mtFile)
    {
        List<MtFile> list = mtFileService.selectMtFileList(mtFile);
//        ExcelUtil<MtFile> util = new ExcelUtil<MtFile>(MtFile.class);
//        util.exportExcel(response, list, "会议文件数据");
    }

    /**
     * 获取会议文件详细信息
     */
    @GetMapping(value = "/{fileId}")
    public AjaxResult getInfo(@PathVariable("fileId") Long fileId)
    {
        return success(mtFileService.selectMtFileByFileId(fileId));
    }

    /**
     * 新增会议文件
     */
    @PostMapping
    public AjaxResult add(@RequestBody MtFile mtFile)
    {
        return toAjax(mtFileService.insertMtFile(mtFile));
    }

    /**
     * 修改会议文件
     */
    @PutMapping
    public AjaxResult edit(@RequestBody MtFile mtFile)
    {
        return toAjax(mtFileService.updateMtFile(mtFile));
    }

    /**
     * 删除会议文件
     */
	@DeleteMapping("/{fileIds}")
    public AjaxResult remove(@PathVariable Long[] fileIds)
    {
        return toAjax(mtFileService.deleteMtFileByFileIds(fileIds));
    }
}
